<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>创梦科技网站管理后台登录页面</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="${ctx}/static/admin/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="${ctx}/static/admin/layui/css/admin.css" media="all">
  <link rel="stylesheet" href="${ctx}/static/admin/layui/css/login.css" media="all">
  <link href="${ctx}/favicon.ico" rel="SHORTCUT ICON" />
  <script src="${ctx}/static/jquery/jquery.min.js"></script>
  <style type="text/css">
@-webkit-keyframes animate-cloud {
  from {
    background-position: 600px 100%;
  }
  to {
    background-position: 0 100%;
  }
}
@-moz-keyframes animate-cloud {
  from {
    background-position: 600px 100%;
  }
  to {
    background-position: 0 100%;
  }
}
@-ms-keyframes animate-cloud {
  from {
    background-position: 600px 100%;
  }
  to {
    background-position: 0 100%;
  }
}
@-o-keyframes animate-cloud {
  from {
    background-position: 600px 100%;
  }
  to {
    background-position: 0 100%;
  }
}
html{
	height: 100%;
}
#LAY-user-login{
    font:12px "microsoft yahei";
    color: #565656;
    /*background:url(${ctx}/img/pingpu2.jpg) 0 bottom repeat #049ec4;*/
    -webkit-animation: animate-cloud 20s linear infinite;
    -moz-animation: animate-cloud 20s linear infinite;
    -ms-animation: animate-cloud 20s linear infinite;
    -o-animation: animate-cloud 20s linear infinite;
    animation: animate-cloud 20s linear infinite;
    width: 100%;
    height: auto;
}
.signup_container{
	width:540px;
	height: auto;
	margin:10% auto 0;
	padding-bottom: 20px;
	background: #EDEDED;
	text-align: center;
	border-radius: 8px;
	box-shadow: 1px 2px 4px rgba(0,0,0,0.6);
	-webkit-user-select:none;
	-ms-user-select:none;
}
.layui-form-checkbox{
    margin-left: 0px;
}
  </style>
</head>
<body>

  <div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login" style="display: none;">
    <div class='signup_container'>
	    <div class="layadmin-user-login-main">
	      <div class="layadmin-user-login-box layadmin-user-login-header">
	        <h2>创梦科技网站管理后台</h2>
	        <p>创梦科技网站管理后台登录页面</p>
	      </div>
	      <div class="layadmin-user-login-box layadmin-user-login-body layui-form">
	        <div class="layui-form-item">
	          <label class="layadmin-user-login-icon layui-icon layui-icon-username" for="LAY-user-login-username"></label>
	          <input type="text" name="username" id="LAY-user-login-username" lay-verify="required|nickname" placeholder="用户名" class="layui-input">
	        </div>
	        <div class="layui-form-item">
	          <label class="layadmin-user-login-icon layui-icon layui-icon-password" for="LAY-user-login-password"></label>
	          <input type="password" name="password" id="LAY-user-login-password" lay-verify="required|pass" placeholder="密码" class="layui-input">
	        </div>
	        <div class="layui-form-item" style="margin-bottom: 20px;text-align: right">
	          <input type="checkbox" name="autoLogin" value="1" lay-skin="primary" title="记住我"/>
	        </div>
	        <div class="layui-form-item">
	          <button id="LAY-user-login-submit" class="layui-btn layui-btn-fluid" lay-submit lay-filter="LAY-user-login-submit">登 录</button>
	        </div>
	      </div>
	    </div>
    </div>
    
    <div class="layui-trans layadmin-user-login-footer">
      
      <p>© 2019 <a href="http://www.layui.com/" target="_blank">郑州创梦计算机科技有限公司</a></p>
      <p>
        <span><a href="http://www.layui.com/admin/#get" target="_blank">获取授权</a></span>
        <span><a href="http://www.layui.com/admin/pro/" target="_blank">在线演示</a></span>
        <span><a href="http://www.layui.com/admin/" target="_blank">前往官网</a></span>
      </p>
    </div>
    
  </div>

  <script src="${ctx}/static/admin/layui/layui.js"></script>
  <script>
  $(function(){
      $('#LAY-user-login-username').focus();
	  $('#LAY-user-login-username').on('keydown', function (event) {
	        if (event.keyCode == 13) {
	            $("#LAY-user-login-submit").trigger("click");
	            return false;
	        }
	  });
	  $('#LAY-user-login-password').on('keydown', function (event) {
	        if (event.keyCode == 13) {
	            $("#LAY-user-login-submit").trigger("click");
	            return false;
	        }
	  });
  });
  layui.config({
    base: '${ctx}/static/admin/js/' //静态资源所在路径
  }).extend({
    index: 'index' //主入口模块
  }).use(['index', 'user'], function(){
    var $ = layui.$
    ,setter = layui.setter
    ,admin = layui.admin
    ,form = layui.form
    ,router = layui.router()
    ,search = router.search;

    form.render();

    //提交
    form.on('submit(LAY-user-login-submit)', function(obj){
      //请求登入接口
      admin.req({
        url: '${ctx}/sys_admin/login/dologin',
        data: obj.field,
        done: function(res){
          //请求成功后，写入 access_token
          /*layui.data(setter.tableName, {
            key: setter.request.tokenName
            ,value: res.data.access_token
          });*/
          
          //登入成功的提示与跳转
          layer.msg('登录成功！', {
            offset: '15px'
            ,icon: 1
            ,time: 1000
          }, function(){
            location.href = '${ctx}/sys_admin/main'; //后台主页
          });
        }
      });
      
    });
    
  });
  </script>
</body>
</html>